home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / w00w00 / sectools / ngrep / configure.in < prev    next >
Encoding:
Text File  |  2000-02-01  |  3.1 KB  |  150 lines

  1. dnl
  2. dnl $Id: configure.in,v 1.18 2000/02/01 10:48:55 jpr5 Exp $
  3. dnl
  4.  
  5. AC_INIT(ngrep.c)
  6.  
  7. AC_CANONICAL_SYSTEM
  8.  
  9. AC_PROG_CC
  10. AC_PREFIX(gcc)
  11.  
  12.  
  13. AC_HEADER_STDC
  14. AC_CHECK_HEADER(strings.h,,echo need strings header; exit)
  15. AC_CHECK_HEADER(netinet/if_ether.h,AC_DEFINE(HAVE_IF_ETHER_H,1),)
  16.  
  17.  
  18. AC_MSG_CHECKING(for a complete set of pcap headers)
  19. possible_dirs="/usr/include /usr/include/pcap \
  20.                /usr/local/include /usr/local/include/pcap \
  21.                /usr/share/include /usr/share/include/pcap"
  22. pcap_dir=""
  23.  
  24. for dir in $possible_dirs ; do 
  25.     if test -d $dir -a -r "$dir/pcap.h" -a \
  26.                        -r "$dir/net/bpf.h" ; then 
  27.        if test -n "$pcap_dir" ; then
  28.           echo 
  29.           echo; echo more than one set found in:
  30.           echo  $pcap_dir 
  31.           echo  $dir
  32.           echo; echo please wipe out all unused pcap installations
  33.           exit
  34.        else 
  35.           pcap_dir="$dir"
  36.        fi
  37.     fi
  38. done
  39.  
  40. if test -z "$pcap_dir" ; then
  41.    echo no; echo couldn\'t find a complete set of pcap headers
  42.    exit
  43. else
  44.    AC_SUBST(PCAP_INCLUDE)
  45.    PCAP_INCLUDE="-I$pcap_dir"
  46.    echo found $pcap_dir
  47.    
  48.    AC_MSG_CHECKING(for usable bpf.h)
  49.    if test -n "`grep DLT_RAW $pcap_dir/net/bpf.h`" ; then
  50.       echo yep
  51.    else 
  52.  
  53. echo nope
  54. echo '***************************************************************'
  55. echo an important define is missing from the bpf.h I found.  this
  56. echo probably means that your installation of pcap is outdated and
  57. echo needs upgrading.  I\'ll go ahead and add the define for you but
  58. echo understand that matching certain types of packets may not 
  59. echo function properly.
  60. echo '***************************************************************'
  61. sleep 2
  62.  
  63. AC_DEFINE(DLT_RAW, 12)
  64.  
  65.    fi
  66. fi
  67.  
  68.  
  69.  
  70. AC_C_CONST
  71. AC_TYPE_SIZE_T
  72. AC_TYPE_SIGNAL
  73. AC_FUNC_ALLOCA
  74.  
  75.  
  76. AC_DEFINE(_BSD_SOURCE)
  77. AC_DEFINE(__FAVOR_BSD)
  78.  
  79. case "$target_os" in
  80.  
  81. *linux*)
  82.     AC_DEFINE(LINUX)
  83.  
  84.     AC_MSG_CHECKING(for a dumb udphdr declaration)
  85.     AC_TRY_COMPILE(,
  86. #ifndef __FAVOR_BSD
  87. #define __FAVOR_BSD
  88. #endif
  89.  
  90. #ifndef _BSD_SOURCE
  91. #define _BSD_SOURCE 1
  92. #endif
  93.  
  94. #include <netinet/udp.h>
  95.  
  96. struct udphdr foo;
  97. unsigned short bar = foo.uh_sport;
  98. ,
  99.     echo nope,
  100.         echo yep dumb; AC_DEFINE(HAVE_DUMB_UDPHDR))
  101.  
  102.         ;;
  103.  
  104. *bsd*)
  105.     AC_DEFINE(BSD)
  106.  
  107.         ;;
  108.  
  109. *solaris*)
  110.     AC_DEFINE(SOLARIS)
  111.  
  112.         AC_CHECK_LIB(socket, socket,,
  113.                      echo no socket in -lsocket\?; exit)
  114.         AC_CHECK_LIB(nsl, gethostbyname,,
  115.                      echo no gethostbyname in -lnsl\?; exit)
  116.  
  117.     LIBS="$LIBS -lnsl -lsocket"
  118.  
  119.         AC_SUBST(EXTRA_LIBS)
  120.     EXTRA_LIBS='-lnsl -lsocket'
  121.  
  122.     ;;
  123.  
  124. *osf*)
  125.     AC_DEFINE(OSF1)
  126.     AC_DEFINE(__STDC__, 2)
  127.  
  128.     ;;
  129.  
  130. *)
  131.         AC_MSG_WARN(Your OS ($target_os) is not supported yet.  Try\
  132.                     playing with the build host and target options.)
  133.  
  134.         ;;
  135.  
  136. esac
  137.  
  138.  
  139. AC_CHECK_LIB(pcap, pcap_open_live,,echo need pcap lib; exit)
  140.  
  141. AC_CHECK_LIB(pcap, pcap_restart, AC_DEFINE(PCAP_RESTART,pcap_restart),
  142.  AC_CHECK_LIB(pcap, pcap_yyrestart, AC_DEFINE(PCAP_RESTART,pcap_yyrestart),
  143.   AC_CHECK_LIB(pcap, yyrestart, AC_DEFINE(PCAP_RESTART,yyrestart),
  144.    echo no yacc restart func found
  145.    echo perhaps libpcap wasn\'t compiled with bison/flex\?
  146.    exit)))
  147.  
  148.  
  149. AC_OUTPUT(Makefile)
  150.